# -*- coding: utf-8 -*-
# @author: wch
# @file: videocapture.py
# @time: 2023/1/30 14:54

# 视频采集
# VideoCapure()
# cap.read()
# cap.release()

import cv2

# 创建窗口
cv2.namedWindow("video", cv2.WINDOW_NORMAL)

cap = cv2.VideoCapture(r"E:\dyk\opencvedu\media\c445.mp4")

while cap.isOpened():
    # 从摄像头读取视频
    ret, frame = cap.read()

    # 将视频帧在窗口中显示
    cv2.imshow("video", frame)

    # 等待键盘时间，如果为q，退出
    key = cv2.waitKey(100)
    if (key & 0xFF == ord("q")):
        break
    # 释放VideoCapture

cap.release()
